import { Inject, Injectable } from '@nestjs/common';
import { ApiService } from '../todo-list.apiservice';
import { Repository } from './todo-list.repository';
import { Todo } from 'src/schema/todo.schema';
import { AddNewTodoDto } from '../dto/add-new-todo.dto';

@Injectable()
export class RepositoryImpl implements Repository {
  constructor(@Inject(ApiService) private readonly apiservice: ApiService) {}

  add(dto: AddNewTodoDto): Promise<Todo> {
    return this.apiservice.add(dto);
  }
  findAllTodos(): Promise<Todo[]> {
    return this.apiservice.findAllTodos();
  }
}
